#pragma once


const float PI = 3.14159265358979323846f;
const float PI2 = 1.57079632679489661923f;

//	round routine
inline float round(float number)
{
	return floor(number + .5f);
}

//	radians to degrees conversion
inline float rad2deg(float radians)
{
	return radians * 180.0f / PI;
}

inline float deg2rad(float degrees)
{
	return degrees * PI / 180.0f;
}

inline uint next_power_of_2(uint val)
{
	uint result(1);
	while (result <= val)
		result <<= 1;

	return result;
}

template <typename T>
inline T min(T a, T b)
{
	return a < b ? a : b;
}

template <typename T>
inline T max(T a, T b)
{
	return a > b ? a : b;
}

template <typename T>
inline T clamp(T val, T min_value, T max_value)
{
	assert(min_value <= max_value);

	val = max(val, min_value);
	val = min(val, max_value);
	return val;
}